﻿@illustration_christian = "gfx/interface/illustrations/holding_types/temple_christian.dds"
@illustration_generic_grass = "gfx/interface/illustrations/holding_types/temple_generic_grass.dds"
@illustration_generic_arid = "gfx/interface/illustrations/holding_types/temple_generic_arid.dds"
@illustration_india = "gfx/interface/illustrations/holding_types/temple_india.dds"
@illustration_islamic = "gfx/interface/illustrations/holding_types/temple_islamic.dds"
@illustration_orthodox = "gfx/interface/illustrations/holding_types/temple_orthodox.dds"
@illustration_northern_pagan = "gfx/interface/illustrations/holding_types/temple_northern_pagan.dds"
@illustration_iberian_christian = "gfx/interface/illustrations/holding_types/fp2_temple_iberian_christian.dds"
@illustration_iberian_islamic = "gfx/interface/illustrations/holding_types/fp2_temple_iberian_islamic.dds"
@illustration_iranian_zoroastrian = "gfx/interface/illustrations/holding_types/fp3_temple_iranian_zoroastrian.dds"
@illustration_tengri = "gfx/interface/illustrations/holding_types/mpo_temple_steppe.dds"

temple_01 = {
	construction_time = slow_construction_time

	### GENERIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_generic_01_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_generic_01_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_generic_01_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_generic_01_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
		graphical_regions = { "graphical_mena" }
	}

	asset = {
		type = pdxmesh
		name = "building_western_temple_pagan_01_mesh"
		illustration = @illustration_northern_pagan
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "pagan_gfx" }
	}

	### DHARMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ORTHODOX ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### CATHOLIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ISLAMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	# FP2 Catholic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_christian_01_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP2 Islamic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_mosque_01_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP3 Zoroastrian
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_01_mesh"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}
	asset = {
		type = entity
		name = "fp3_building_persian_temple_01_a_01_entity"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_iranian_zoroastrian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } } ##todo_cd_polish fix
		graphical_faiths = { "zoroastrian_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}

	# MPO Tengri
	asset = {
		type = entity
		name = "mpo_mongol_temple_01_entity"
		illustration = @illustration_tengri
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "tengrism_gfx" }
	}

	can_construct_potential = {
		barony_cannot_construct_holding = no
	}

	can_construct = {
		trigger_if = {
			limit = {
				NOR = {
					scope:holder.culture = {
						has_cultural_parameter = tribals_can_into_temples
						has_cultural_parameter = temple_next_level
					}
				}
			}
			scope:holder.culture = {
				has_innovation = innovation_city_planning
			}
		}
		trigger_else = {
			scope:holder.culture = {
				OR = {
					has_cultural_parameter = tribals_can_into_temples
					has_cultural_parameter = temple_next_level
				}
			}
		}

	}

	can_construct_showing_failures_only = {
		trigger_if = {
			limit = {
				NOT = {
					scope:holder.culture = {
						has_cultural_parameter = tribals_can_into_temples
					}
				}
			}
			building_requirement_tribal = no
			building_requirement_tribal_holding_in_county = yes
		}
		trigger_else = {
			scope:holder.culture = {
				has_cultural_parameter = tribals_can_into_temples
			}
		}
		building_requirement_nomad = no
		building_requirement_nomad_holding_in_county = yes
		building_requirement_herder = no
		building_requirement_herder_holding_in_county = yes
	}
	cost_gold = main_building_tier_1_cost
	next_building = temple_02

	levy = poor_building_levy_tier_1
	max_garrison = normal_building_max_garrison_tier_1
	garrison_reinforcement_factor = building_garrison_reinforcement_factor_tier_1
	province_modifier = {
		monthly_income = normal_building_tax_tier_3
		stationed_maa_damage_mult = low_maa_damage_tier_1
		stationed_maa_toughness_mult = low_maa_toughness_tier_1
		stationed_siege_weapon_siege_value_mult = low_maa_siege_value_tier_1
		travel_danger = -10
	}
	province_terrain_modifier = {
		parameter = coastal_holding_bonuses
		is_coastal = yes
		build_speed = -0.1
	}

	province_terrain_modifier = {
		parameter = maritime_mercantilism_coastal_holdings
		is_coastal = yes
		tax_mult = maritime_mercantilism_coastal_holdings_value
	}

	province_terrain_modifier = {
		parameter = coastal_holdings_give_defensive_bonus
		is_coastal = yes
		defender_holding_advantage = 2
	}

	flag = temple

	type_icon = "icon_building_monastic_schools.dds"

	on_complete = {
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = renown_from_temple_construction
				}
				exists = county.holder.dynasty
			}
			county.holder.dynasty = { add_dynasty_prestige = major_dynasty_prestige_value }
		}
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = extra_piety_from_temple_construction
				}
			}
			county.holder = { add_piety = omega_piety_gain }
		}
		else = {
			county.holder = { add_piety = massive_piety_gain }
		}
		save_scope_as = temple_location
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = more_fervor_on_church_construction
				}
			}
			county.holder.faith = {
				change_fervor = {
					value = 5
					desc = fervor_gain_built_temple_holding
				}
			}
		}
		else = {
			county.holder.faith = {
				change_fervor = {
					value = 1
					desc = fervor_gain_built_temple_holding
				}
			}
		}
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = prestige_from_temple_construction
				}
			}
			county.holder = { add_prestige = massive_prestige_gain }
		}

		#Holy Legend Seed drop
		if = {
			limit = {
				county.holder = { has_dlc_feature = legends }
				county.holder = {
					NOR = {
						has_game_rule = historical_legends_only
						has_personal_legend_seed = holy
					}
				}
			}
			random = {
				chance = {
					value = 10
					if = {
						limit = { county.holder.piety_level >= high_piety_level }
						add = 15 #25%
					}
					if = {
						limit = { county.holder.piety_level >= max_piety_level }
						add = 25 #50%
					}
				}
				county.holder = {
					send_interface_toast = {
						type = msg_legend_seed_created
						title = holy_seed_toast
						left_icon = root.barony
						create_legend_seed = {
							type = holy
							quality = famed
							chronicle = saintly_building
							properties = {
								location = prev
								religion = this.religion
								faith = this.faith
							}
						}
					}
				}
			}
		}

		#to give follow-up to the vassal.1001 event
		hidden_effect = {
			if = {
				limit = {
					exists = province_owner
				}
				province_owner = {
					save_scope_as = owner_of_province

					scope:owner_of_province = {
						if = { #Religious liege asked me to build a temple
							limit = {
								exists = var:promised_to_build_temple
								var:promised_to_build_temple = {
									is_alive = yes
									faith = scope:owner_of_province.faith
								}
								has_character_flag = promised_liege_temple
							}
							trigger_event = vassal.1010
						}
						if = { #Religious vassal asked me to build a temple
							limit = {
								exists = var:promised_to_build_temple
								var:promised_to_build_temple = {
									is_alive = yes
									faith = scope:owner_of_province.faith
								}
								has_character_flag = promised_vassal_temple
							}
							trigger_event = vassal.1110
						}

						#To remove the variables if the character has died or someone has changed their faith
						if = {
							limit = {
								exists = var:promised_to_build_temple
								OR = {
									var:promised_to_build_temple = { is_alive = no }
									NOT = { faith = scope:owner_of_province.faith }
								}
							}
							remove_variable = promised_to_build_temple
						}
					}
				}
			}
		}
		county.holder = {
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = parochial
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = parochial_vassal_approves_holding_construction
				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = parochial
						}
						add_opinion = {
							target = prev
							modifier = parochial_approves_holding_construction_opinion
						}
					}
				}
			}
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = zealot
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = zealot_vassal_approves_holding_construction
				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = zealot
						}
						add_opinion = {
							target = prev
							modifier = zealot_approves_temple_construction_opinion
						}
					}
				}
			}
		}

		# Building Oath
		hidden_effect = {
			if = {
				limit = {
					county.holder = {
						has_character_modifier = oath_of_buildings
					}
				}
				add_random_economic_building_effect = yes
				add_random_military_building_effect = yes
				add_random_fortification_building_effect = yes
			}
		}
	}

	ai_value = {
		base = 100
		modifier = {
			factor = 0
			scope:holder = {
				NOT = { government_has_flag = government_is_theocracy }
			}
		}
		modifier = {
			add = 50
			county = {
				NOT = {
					any_county_province = {
						has_building_or_higher = temple_01
					}
				}
			}
		}
	}
}

temple_02 = {
	construction_time = slow_construction_time

	### GENERIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_generic_01_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_generic_01_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_generic_01_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_generic_01_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 0 } }
		graphical_regions = { "graphical_mena" }
	}

	asset = {
		type = pdxmesh
		name = "building_western_temple_pagan_01_mesh"
		illustration = @illustration_northern_pagan
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "pagan_gfx" }
	}

	### DHARMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_dharmic_01_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ORTHODOX ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_orthodox_01_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### CATHOLIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_christian_01_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ISLAMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_01_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	# FP2 Catholic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_christian_01_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP2 Islamic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_mosque_01_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP3 Zoroastrian
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_01_mesh"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}
	asset = {
		type = entity
		name = "fp3_building_persian_temple_01_a_01_entity"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_iranian_zoroastrian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 0 } } ##todo_cd_polish fix
		graphical_faiths = { "zoroastrian_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}

	# MPO Tengri
	asset = {
		type = entity
		name = "mpo_mongol_temple_01_entity"
		illustration = @illustration_tengri
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "tengrism_gfx" }
	}

	can_construct_potential = {
		building_requirement_tribal = no
	}
	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					scope:holder.culture = {
						has_cultural_parameter = temple_next_level
					}
				}
			}
			scope:holder.culture = {
				has_innovation = innovation_manorialism
			}
		}
		trigger_else = {
			scope:holder.culture = {
				has_cultural_parameter = temple_next_level
				has_innovation = innovation_city_planning
			}
		}
	}
	cost_gold = main_building_tier_2_cost
	next_building = temple_03

	levy = poor_building_levy_tier_3
	max_garrison = normal_building_max_garrison_tier_3
	garrison_reinforcement_factor = building_garrison_reinforcement_factor_tier_2
	province_modifier = {
		monthly_income = normal_building_tax_tier_5
		stationed_maa_damage_mult = low_maa_damage_tier_2
		stationed_maa_toughness_mult = low_maa_toughness_tier_2
		stationed_siege_weapon_siege_value_mult = low_maa_siege_value_tier_2
		travel_danger = -12
	}

	province_terrain_modifier = {
		parameter = coastal_holding_bonuses
		is_coastal = yes
		build_speed = -0.1
	}

	province_terrain_modifier = {
		parameter = maritime_mercantilism_coastal_holdings
		is_coastal = yes
		tax_mult = maritime_mercantilism_coastal_holdings_value
	}

	province_terrain_modifier = {
		parameter = coastal_holdings_give_defensive_bonus
		is_coastal = yes
		defender_holding_advantage = 3
	}

	flag = temple

	on_complete = {
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = renown_from_temple_construction
				}
				exists = county.holder.dynasty
			}
			county.holder.dynasty = { add_dynasty_prestige = medium_dynasty_prestige_value }
		}
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = more_fervor_on_church_construction
				}
			}
			county.holder.faith = {
				change_fervor = {
					value = 2
					desc = fervor_gain_upgraded_temple_holding_culture_parameter
				}
			}
		}
		barony.holder = {
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = parochial
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = parochial_vassal_approves_holding_upgrade
				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = parochial
						}
						add_opinion = {
							target = prev
							modifier = parochial_approves_holding_upgrade_opinion
						}
					}
				}
			}
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = zealot
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = zealot_vassal_approves_holding_upgrade
				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = zealot
						}
						add_opinion = {
							target = prev
							modifier = zealot_approves_temple_upgrade_opinion
						}
					}
				}
			}
		}
	}

	ai_value = {
		base = 6
		modifier = {
			factor = 2
			scope:holder.capital_province = this
		}
		modifier = {
			factor = 0.1
			free_building_slots >= 1
		}
		modifier = {
			factor = 0.1
			combined_building_level <= 10
			years_from_game_start >= 1
		}
		modifier = {
			factor = 0.3
			years_from_game_start <= 0.05
		}
	}
}

temple_03 = {
	construction_time = slow_construction_time

	### GENERIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_generic_02_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_generic_02_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_generic_02_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_generic_02_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
		graphical_regions = { "graphical_mena" }
	}

	asset = {
		type = pdxmesh
		name = "building_western_temple_pagan_02_mesh"
		illustration = @illustration_northern_pagan
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "pagan_gfx" }
	}

	### DHARMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ORTHODOX ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### CATHOLIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ISLAMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	# FP2 Catholic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_christian_02_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP2 Islamic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_mosque_02_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP3 Zoroastrian
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_02_mesh"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}
	asset = {
		type = entity
		name = "fp3_building_persian_temple_02_a_01_entity"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_iranian_zoroastrian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } } ##todo_cd_polish fix
		graphical_faiths = { "zoroastrian_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}

	# MPO Tengri
	asset = {
		type = entity
		name = "mpo_mongol_temple_01_entity"
		illustration = @illustration_tengri
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "tengrism_gfx" }
	}

	can_construct_potential = {
		building_requirement_tribal = no
	}
	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					scope:holder.culture = {
						has_cultural_parameter = temple_next_level
					}
				}
			}
			scope:holder.culture = {
				has_innovation = innovation_windmills
			}
		}
		trigger_else = {
			scope:holder.culture = {
				has_cultural_parameter = temple_next_level
				has_innovation = innovation_manorialism
			}
		}
	}
	cost_gold = main_building_tier_3_cost
	next_building = temple_04

	levy = poor_building_levy_tier_5
	max_garrison = normal_building_max_garrison_tier_5
	garrison_reinforcement_factor = building_garrison_reinforcement_factor_tier_3
	province_modifier = {
		monthly_income = normal_building_tax_tier_7
		stationed_maa_damage_mult = low_maa_damage_tier_3
		stationed_maa_toughness_mult = low_maa_toughness_tier_3
		stationed_siege_weapon_siege_value_mult = low_maa_siege_value_tier_3
		travel_danger = -14
	}
	province_terrain_modifier = {
		parameter = coastal_holding_bonuses
		is_coastal = yes
		build_speed = -0.1
	}

	province_terrain_modifier = {
		parameter = maritime_mercantilism_coastal_holdings
		is_coastal = yes
		tax_mult = maritime_mercantilism_coastal_holdings_value
	}

	province_terrain_modifier = {
		parameter = coastal_holdings_give_defensive_bonus
		is_coastal = yes
		defender_holding_advantage = 4
	}

	flag = temple

	on_complete = {
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = renown_from_temple_construction
				}
				exists = county.holder.dynasty
			}
			county.holder.dynasty = { add_dynasty_prestige = medium_dynasty_prestige_value }
		}
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = more_fervor_on_church_construction
				}
			}
			county.holder.faith = {
				change_fervor = {
					value = 2
					desc = fervor_gain_upgraded_temple_holding_culture_parameter
				}
			}
		}
		barony.holder = {
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = parochial
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = parochial_vassal_approves_holding_upgrade
				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = parochial
						}
						add_opinion = {
							target = prev
							modifier = parochial_approves_holding_upgrade_opinion
						}
					}
				}
			}
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = zealot
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = zealot_vassal_approves_holding_upgrade
				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = zealot
						}
						add_opinion = {
							target = prev
							modifier = zealot_approves_temple_upgrade_opinion
						}
					}
				}
			}
		}
	}

	ai_value = {
		base = 5
		modifier = {
			factor = 2
			scope:holder.capital_province = this
		}
		modifier = {
			factor = 0.2
			combined_building_level <= 20
			years_from_game_start >= 1
		}
	}
}

temple_04 = {
	construction_time = slow_construction_time

	### GENERIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_generic_02_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_generic_02_mesh"
		illustration = @illustration_generic_grass
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_generic_02_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_generic_02_mesh"
		illustration = @illustration_generic_arid
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/generic_temple" soundparameter = { "Tier" = 1 } }
		graphical_regions = { "graphical_mena" }
	}

	asset = {
		type = pdxmesh
		name = "building_western_temple_pagan_02_mesh"
		illustration = @illustration_northern_pagan
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "pagan_gfx" }
	}

	### DHARMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_dharmic_02_mesh"
		illustration = @illustration_india
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/dharmic_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "dharmic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ORTHODOX ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_orthodox_02_mesh"
		illustration = @illustration_orthodox
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/orthodox_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "orthodox_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### CATHOLIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_christian_02_mesh"
		illustration = @illustration_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_regions = { "graphical_mena" }
	}

	### ISLAMIC ###
	asset = {
		type = pdxmesh
		name = "building_western_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
	}
	asset = {
		type = pdxmesh
		name = "building_mediterranean_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mediterranean" }
	}
	asset = {
		type = pdxmesh
		name = "building_indian_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_india" }
	}
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_02_mesh"
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_regions = { "graphical_mena" }
	}
	# FP2 Catholic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_christian_02_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_christian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/church_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "catholic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP2 Islamic variant for Iberia
	asset = {
		type = pdxmesh
		name = "fp2_building_iberian_mosque_02_mesh"
		requires_dlc_flag = the_fate_of_iberia
		illustration = @illustration_iberian_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iberian_building_gfx }
		graphical_regions = { graphical_mediterranean }
	}

	# FP3 Zoroastrian
	asset = {
		type = pdxmesh
		name = "building_mena_temple_islamic_02_mesh"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_islamic
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } }
		graphical_faiths = { "islamic_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}
	asset = {
		type = entity
		name = "fp3_building_persian_temple_02_a_01_entity"
		requires_dlc_flag = legacy_of_persia
		illustration = @illustration_iranian_zoroastrian
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/mosque_temple" soundparameter = { "Tier" = 1 } } ##todo_cd_polish fix
		graphical_faiths = { "zoroastrian_gfx" }
		graphical_cultures = { iranian_building_gfx }
		graphical_regions = { graphical_mena }
	}

	# MPO Tengri
	asset = {
		type = entity
		name = "mpo_mongol_temple_01_entity"
		illustration = @illustration_tengri
		soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/pagan_temple" soundparameter = { "Tier" = 0 } }
		graphical_faiths = { "tengrism_gfx" }
	}

	can_construct_potential = {
		building_requirement_tribal = no
	}
	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					scope:holder.culture = {
						has_cultural_parameter = temple_next_level
					}
				}
			}
			scope:holder.culture = {
				has_innovation = innovation_cranes
			}
		}
		trigger_else = {
			scope:holder.culture = {
				has_cultural_parameter = temple_next_level
				has_innovation = innovation_windmills
			}
		}
	}
	cost_gold = main_building_tier_4_cost

	levy = poor_building_levy_tier_7
	max_garrison = normal_building_max_garrison_tier_7
	garrison_reinforcement_factor = building_garrison_reinforcement_factor_tier_4
	province_modifier = {
		monthly_income = good_building_tax_tier_6
		stationed_maa_damage_mult = low_maa_damage_tier_4
		stationed_maa_toughness_mult = low_maa_toughness_tier_4
		stationed_siege_weapon_siege_value_mult = low_maa_siege_value_tier_4
		travel_danger = -16
	}
	province_terrain_modifier = {
		parameter = coastal_holding_bonuses
		is_coastal = yes
		build_speed = -0.1
	}

	province_terrain_modifier = {
		parameter = maritime_mercantilism_coastal_holdings
		is_coastal = yes
		tax_mult = maritime_mercantilism_coastal_holdings_value
	}

	province_terrain_modifier = {
		parameter = coastal_holdings_give_defensive_bonus
		is_coastal = yes
		defender_holding_advantage = 5
	}

	flag = temple

	on_complete = {
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = renown_from_temple_construction
				}
				exists = county.holder.dynasty
			}
			county.holder.dynasty = { add_dynasty_prestige = medium_dynasty_prestige_value }
		}
		if = {
			limit = {
				county.holder.culture = {
					has_cultural_parameter = more_fervor_on_church_construction
				}
			}
			county.holder.faith = {
				change_fervor = {
					value = 2
					desc = fervor_gain_upgraded_temple_holding_culture_parameter
				}
			}
		}
		barony.holder = {
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = parochial
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = parochial_vassal_approves_holding_upgrade
				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = parochial
						}
						add_opinion = {
							target = prev
							modifier = parochial_approves_holding_upgrade_opinion
						}
					}
				}
			}
			if = {
				limit = {
					any_vassal = {
						has_vassal_stance = zealot
					}
					save_temporary_scope_as = holder_scope
				}
				custom_tooltip = zealot_vassal_approves_holding_upgrade

				hidden_effect = {
					every_vassal = {
						limit = {
							has_vassal_stance = zealot
						}
						add_opinion = {
							target = prev
							modifier = zealot_approves_temple_upgrade_opinion
						}
					}
				}
			}
		}
	}

	ai_value = {
		base = 4
		modifier = {
			factor = 2
			scope:holder.capital_province = this
		}
		modifier = {
			factor = 0.2
			combined_building_level <= 30
			years_from_game_start >= 1
		}
	}
}

####
#
# Temple Buildings
#
####

### Scriptorium

scriptorium_01 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_01
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_1_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.05
		legitimacy_gain_mult = 0.01
	}

	character_modifier = {
		monthly_piety = 0.1
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.1
	}

	next_building = scriptorium_02

	type_icon = "icon_building_library.dds"

	ai_value = {
		base = 10
		ai_tier_1_building_modifier = yes
		modifier = {
			add = 250
			scope:holder = {
				OR = {
					highest_held_title_tier = tier_barony
					government_has_flag = government_is_theocracy
					is_theocratic_lessee = yes
				}
			}
		}
		modifier = {
			factor = 2
			free_building_slots <= 1
		}
		modifier = {
			factor = 0
			NOT = {
				has_building_or_higher = monastic_schools_01
			}
		}
		modifier = {
			factor = 0
			building_farm_estates_requirement_terrain = yes
			NOT = {
				has_building_or_higher = farm_estates_01
			}
		}
		modifier = {
			factor = 0
			building_cereal_fields_requirement_terrain = yes
			NOT = {
				has_building_or_higher = cereal_fields_01
			}
		}
	}
}

scriptorium_02 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_01
		culture = {
			has_innovation = innovation_city_planning
		}
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_2_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.1
		legitimacy_gain_mult = 0.02
	}

	character_modifier = {
		monthly_piety = 0.2
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.2
	}

	next_building = scriptorium_03
	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

scriptorium_03 = {
	construction_time = standard_construction_time

	can_construct = {
		has_building_or_higher = temple_02
		culture = {
			has_innovation = innovation_manorialism
		}
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_3_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.15
		legitimacy_gain_mult = 0.03
	}

	character_modifier = {
		monthly_piety = 0.3
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.3
	}

	next_building = scriptorium_04
	ai_value = {
		base = 8
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

scriptorium_04 = {
	construction_time = standard_construction_time

	can_construct = {
		has_building_or_higher = temple_02
		culture = {
			has_innovation = innovation_manorialism
		}
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_4_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.2
		legitimacy_gain_mult = 0.04
	}

	character_modifier = {
		monthly_piety = 0.4
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.4
	}

	next_building = scriptorium_05
	ai_value = {
		base = 7
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

scriptorium_05 = {
	construction_time = standard_construction_time

	can_construct = {
		has_building_or_higher = temple_03
		culture = {
			has_innovation = innovation_windmills
		}
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_5_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.25
		legitimacy_gain_mult = 0.05
	}

	character_modifier = {
		monthly_piety = 0.5
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.5
	}

	next_building = scriptorium_06
	ai_value = {
		base = 7
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

scriptorium_06 = {
	construction_time = standard_construction_time

	can_construct = {
		has_building_or_higher = temple_03
		culture = {
			has_innovation = innovation_windmills
		}
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_6_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.3
		legitimacy_gain_mult = 0.06
	}

	character_modifier = {
		monthly_piety = 0.6
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.6
	}

	next_building = scriptorium_07
	ai_value = {
		base = 7
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

scriptorium_07 = {
	construction_time = standard_construction_time

	can_construct = {
		has_building_or_higher = temple_04
		culture = {
			has_innovation = innovation_cranes
		}
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_7_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.35
		legitimacy_gain_mult = 0.07
	}

	character_modifier = {
		monthly_piety = 0.7
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.7
	}

	next_building = scriptorium_08
	ai_value = {
		base = 7
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

scriptorium_08 = {
	construction_time = standard_construction_time

	can_construct = {
		has_building_or_higher = temple_03
		culture = {
			has_innovation = innovation_cranes
		}
		scope:holder = { has_dlc_feature = legends }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_8_cost

	county_holder_character_modifier = {
		owned_legend_spread_mult = 0.4
		legitimacy_gain_mult = 0.08
	}

	character_modifier = {
		monthly_piety = 0.8
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.8
	}

	ai_value = {
		base = 7
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

### Monastic School

monastic_schools_01 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		building_requirement_castle_city_church = { LEVEL = 01 }
	}

	can_construct_showing_failures_only = {
		#building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_1_cost

	character_modifier = {
		monthly_piety = 0.1
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.1
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_1
		epidemic_resistance = 4
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.1
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 1
	}

	next_building = monastic_schools_02

	type_icon = "icon_building_monastic_schools.dds"

	ai_value = {
		base = 10
		ai_tier_1_building_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = {
			add = 500
			scope:holder = {
				OR = {
					highest_held_title_tier = tier_barony
					government_has_flag = government_is_theocracy
					is_theocratic_lessee = yes
				}
			}
		}
		modifier = {
			factor = 2
			free_building_slots <= 1
		}
	}
}

monastic_schools_02 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		building_requirement_castle_city_church = { LEVEL = 01 }
		culture = {
			OR = {
				has_innovation = innovation_city_planning
				has_cultural_parameter = next_level_monasteries
			}
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_2_cost

	character_modifier = {
		monthly_piety = 0.2
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.2
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_2
		epidemic_resistance = 6
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.1
		learning = 1
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 1
		martial = 1
	}

	next_building = monastic_schools_03
	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

monastic_schools_03 = {
	construction_time = standard_construction_time

	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					culture = {
						has_cultural_parameter = next_level_monasteries
					}
				}
			}
			culture = {
				has_innovation = innovation_manorialism
			}
			building_requirement_castle_city_church = { LEVEL = 02 }
		}
		trigger_else = {
			culture = {
				has_innovation = innovation_city_planning
			}
			culture = {
				has_cultural_parameter = next_level_monasteries
			}
			building_requirement_castle_city_church = { LEVEL = 01 }
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_3_cost

	character_modifier = {
		monthly_piety = 0.3
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.3
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_3
		epidemic_resistance = 8
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.2
		learning = 1
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 2
		martial = 1
	}

	next_building = monastic_schools_04
	ai_value = {
		base = 8
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

monastic_schools_04 = {
	construction_time = standard_construction_time

	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					culture = {
						has_cultural_parameter = next_level_monasteries
					}
				}
			}
			culture = {
				has_innovation = innovation_manorialism
			}
			building_requirement_castle_city_church = { LEVEL = 02 }
		}
		trigger_else = {
			culture = {
				has_innovation = innovation_city_planning
			}
			culture = {
				has_cultural_parameter = next_level_monasteries
			}
			building_requirement_castle_city_church = { LEVEL = 01 }
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_4_cost

	character_modifier = {
		monthly_piety = 0.4
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.4
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_4
		epidemic_resistance = 10
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.2
		learning = 2
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 2
		martial = 2
	}

	next_building = monastic_schools_05
	ai_value = {
		base = 7
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

monastic_schools_05 = {
	construction_time = standard_construction_time

	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					culture = {
						has_cultural_parameter = next_level_monasteries
					}
				}
			}
			culture = {
				has_innovation = innovation_windmills
			}
			building_requirement_castle_city_church = { LEVEL = 03 }
		}
		trigger_else = {
			culture = {
				has_innovation = innovation_city_planning
			}
			culture = {
				has_cultural_parameter = next_level_monasteries
			}
			building_requirement_castle_city_church = { LEVEL = 02 }
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_5_cost

	character_modifier = {
		monthly_piety = 0.5
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.5
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_5
		epidemic_resistance = 12
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.3
		learning = 2
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 3
		martial = 2
	}

	next_building = monastic_schools_06
	ai_value = {
		base = 6
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

monastic_schools_06 = {
	construction_time = standard_construction_time

	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					culture = {
						has_cultural_parameter = next_level_monasteries
					}
				}
			}
			culture = {
				has_innovation = innovation_windmills
			}
			building_requirement_castle_city_church = { LEVEL = 03 }
		}
		trigger_else = {
			culture = {
				has_innovation = innovation_manorialism
			}
			culture = {
				has_cultural_parameter = next_level_monasteries
			}
			building_requirement_castle_city_church = { LEVEL = 02 }
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_6_cost

	character_modifier = {
		monthly_piety = 0.6
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.6
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_6
		epidemic_resistance = 14
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.3
		learning = 3
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 3
		martial = 3
	}

	next_building = monastic_schools_07
	ai_value = {
		base = 5
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

monastic_schools_07 = {
	construction_time = standard_construction_time

	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					culture = {
						has_cultural_parameter = next_level_monasteries
					}
				}
			}
			culture = {
				has_innovation = innovation_cranes
			}
			building_requirement_castle_city_church = { LEVEL = 04 }
		}
		trigger_else = {
			culture = {
				has_innovation = innovation_windmills
			}
			culture = {
				has_cultural_parameter = next_level_monasteries
			}
			building_requirement_castle_city_church = { LEVEL = 03 }
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_7_cost

	character_modifier = {
		monthly_piety = 0.7
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.7
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_7
		epidemic_resistance = 16
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.4
		learning = 3
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 4
		martial = 3
	}

	next_building = monastic_schools_08
	ai_value = {
		base = 4
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

monastic_schools_08 = {
	construction_time = standard_construction_time

	can_construct = {
		trigger_if = {
			limit = {
				NOT = {
					culture = {
						has_cultural_parameter = next_level_monasteries
					}
				}
			}
			culture = {
				has_innovation = innovation_cranes
			}
			building_requirement_castle_city_church = { LEVEL = 04 }
		}
		trigger_else = {
			culture = {
				has_innovation = innovation_windmills
			}
			culture = {
				has_cultural_parameter = next_level_monasteries
			}
			building_requirement_castle_city_church = { LEVEL = 03 }
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_8_cost

	character_modifier = {
		monthly_piety = 0.8
	}
	county_modifier = {
		monthly_county_control_growth_add = 0.8
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_8
		epidemic_resistance = 18
	}

	character_culture_modifier = {
		parameter = monastic_monastery_learning_bonus
		monthly_learning_lifestyle_xp_gain_mult = 0.4
		learning = 4
	}

	character_culture_modifier = {
		parameter = monastery_prowess_martial_bonus
		prowess = 4
		martial = 4
	}

	ai_value = {
		base = 3
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

### Megaliths

megalith_01 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_01
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
	}

	can_construct_showing_failures_only = {
		#building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	show_disabled = yes

	cost_gold = normal_building_tier_1_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_1
	}
	county_modifier = {
		development_growth_factor = 0.02
		county_opinion_add = 2
	}
	province_modifier = {
	}

	next_building = megalith_02

	type_icon = "icon_megalith.dds"

	ai_value = {
		base = 10
		ai_tier_1_building_modifier = yes
		directive_to_build_economy_modifier = yes
		modifier = {
			add = 500
			scope:holder = {
				OR = {
					highest_held_title_tier = tier_barony
					government_has_flag = government_is_theocracy
					is_theocratic_lessee = yes
				}
			}
		}
		modifier = {
			factor = 2
			free_building_slots <= 1
		}
	}
}

megalith_02 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_01
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
	}

	can_construct_showing_failures_only = {
		#building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	cost_gold = normal_building_tier_2_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_2
	}
	county_modifier = {
		development_growth_factor = 0.05
		county_opinion_add = 2
	}
	province_modifier = {
	}

	next_building = megalith_03
	ai_value = {
		base = 9
		directive_to_build_economy_modifier = yes
	}
}

megalith_03 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_01
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
		culture = {
			has_innovation = innovation_city_planning
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	cost_gold = normal_building_tier_3_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_3
	}
	county_modifier = {
		development_growth_factor = 0.1
		county_opinion_add = 4
	}
	province_modifier = {
	}

	next_building = megalith_04
	ai_value = {
		base = 8
		directive_to_build_economy_modifier = yes
	}
}

megalith_04 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_02
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
		culture = {
			has_innovation = innovation_city_planning
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	cost_gold = normal_building_tier_4_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_4
	}
	county_modifier = {
		development_growth_factor = 0.15
		county_opinion_add = 4
		development_growth = 0.025
	}
	province_modifier = {
	}

	next_building = megalith_05
	ai_value = {
		base = 7
		directive_to_build_economy_modifier = yes
	}
}

megalith_05 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_02
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
		culture = {
			has_innovation = innovation_city_planning
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	cost_gold = normal_building_tier_5_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_5
		monthly_prestige = poor_building_tax_tier_1
	}
	county_modifier = {
		development_growth_factor = 0.2
		county_opinion_add = 6
		development_growth = 0.025
	}
	province_modifier = {
	}

	next_building = megalith_06
	ai_value = {
		base = 6
		directive_to_build_economy_modifier = yes
	}
}

megalith_06 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_02
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
		culture = {
			has_innovation = innovation_city_planning
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	cost_gold = normal_building_tier_5_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_6
		monthly_prestige = poor_building_tax_tier_2
	}
	county_modifier = {
		development_growth_factor = 0.25
		county_opinion_add = 6
		development_growth = 0.05
	}
	province_modifier = {
	}

	next_building = megalith_07
	ai_value = {
		base = 5
		directive_to_build_economy_modifier = yes
	}
}

megalith_07 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_02
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
		culture = {
			has_innovation = innovation_city_planning
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	cost_gold = normal_building_tier_5_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_7
		monthly_prestige = poor_building_tax_tier_3
	}
	county_modifier = {
		development_growth_factor = 0.3
		county_opinion_add = 8
		development_growth = 0.05
	}
	province_modifier = {
	}

	next_building = megalith_08
	ai_value = {
		base = 4
		directive_to_build_economy_modifier = yes
	}
}

megalith_08 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		has_building_or_higher = temple_02
		scope:holder.faith = {
			has_doctrine_parameter = can_build_megaliths
		}
		culture = {
			has_innovation = innovation_city_planning
		}
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	is_enabled = {
		custom_tooltip = {
			text = province_is_of_a_megalith_faith_tt
			county.faith = { has_doctrine_parameter = can_build_megaliths }
		}
	}

	cost_gold = normal_building_tier_5_cost

	character_modifier = {
		monthly_piety = poor_building_tax_tier_8
		monthly_prestige = poor_building_tax_tier_4
	}
	county_modifier = {
		development_growth_factor = 0.35
		county_opinion_add = 8
		development_growth = 0.075
	}
	province_modifier = {
	}

	ai_value = {
		base = 3
		directive_to_build_economy_modifier = yes
	}
}

### Breweries (Monks)
breweries_01 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		building_breweries_requirement = { NUMBER = 01 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_1_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 5
		monthly_county_control_growth_add = 0.05
		development_growth_factor = 0.02
	}

	province_modifier = {
		monthly_income = poor_building_tax_tier_1
	}

	next_building = breweries_02

	type_icon = "icon_building_breweries.dds"

	ai_value = {
		base = 10
		ai_tier_1_building_modifier = yes
		modifier = {
			add = 500
			scope:holder = {
				OR = {
					highest_held_title_tier = tier_barony
					government_has_flag = government_is_theocracy
					is_theocratic_lessee = yes
				}
			}
		}
		modifier = {
			factor = 2
			free_building_slots <= 1
		}
	}
}

breweries_02 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		culture = { has_innovation = innovation_city_planning }
		building_breweries_requirement = { NUMBER = 01 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_2_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 10
		monthly_county_control_growth_add = 0.1
		development_growth_factor = 0.04
	}

	province_modifier = {
		monthly_income = poor_building_tax_tier_2
	}

	next_building = breweries_03

	ai_value = {
		base = 10
		ai_tier_1_building_modifier = yes
		modifier = {
			add = 500
			scope:holder = {
				OR = {
					highest_held_title_tier = tier_barony
					government_has_flag = government_is_theocracy
					is_theocratic_lessee = yes
				}
			}
		}
		modifier = {
			factor = 2
			free_building_slots <= 1
		}
	}
}

breweries_03 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		culture = { has_innovation = innovation_manorialism }
		building_breweries_requirement = { NUMBER = 02 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_3_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 15
		monthly_county_control_growth_add = 0.15
		development_growth_factor = 0.06
	}

	province_modifier = {
		monthly_income = poor_building_tax_tier_3
	}

	next_building = breweries_04

	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

breweries_04 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		culture = { has_innovation = innovation_manorialism }
		building_breweries_requirement = { NUMBER = 02 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_4_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 20
		monthly_county_control_growth_add = 0.20
		development_growth_factor = 0.08
	}

	province_modifier = {
		monthly_income = poor_building_tax_tier_4
	}

	next_building = breweries_05

	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

breweries_05 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		culture = { has_innovation = innovation_windmills }
		building_breweries_requirement = { NUMBER = 03 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_5_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 25
		monthly_county_control_growth_add = 0.25
		development_growth_factor = 0.10
	}

	province_modifier = {
		monthly_income = poor_building_tax_tier_5
	}

	next_building = breweries_06

	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

breweries_06 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		culture = { has_innovation = innovation_windmills }
		building_breweries_requirement = { NUMBER = 03 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_6_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 30
		monthly_county_control_growth_add = 0.30
		development_growth_factor = 0.12
	}

	province_modifier = {
		monthly_income = poor_building_tax_tier_6
	}

	next_building = breweries_07

	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

breweries_07 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		culture = { has_innovation = innovation_cranes }
		building_breweries_requirement = { NUMBER = 04 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_7_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 35
		monthly_county_control_growth_add = 0.35
		development_growth_factor = 0.14
	}

	province_modifier = {
		monthly_income = poor_building_tax_tier_7
	}

	next_building = breweries_08

	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}

breweries_08 = {
	construction_time = standard_construction_time

	can_construct_potential = {
		culture = { has_innovation = innovation_cranes }
		building_breweries_requirement = { NUMBER = 04 }
	}

	can_construct_showing_failures_only = {
		building_requirement_tribal = no
	}

	cost_gold = normal_building_tier_8_cost

	effect_desc = brewery_effect_desc

	county_modifier = {
		county_opinion_add = 40
		monthly_county_control_growth_add = 0.40
		development_growth_factor = 0.16
	}
	province_modifier = {
		monthly_income = poor_building_tax_tier_8
	}

	ai_value = {
		base = 9
		ai_general_building_modifier = yes
		ai_economical_building_preference_modifier = yes
		modifier = { # Fill all building slots before going for upgrades
			factor = 0
			free_building_slots > 0
		}
	}
}
